package com.topcheer.demo;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xutao
 * @Package com.topcheer.demo
 * @Description: ${todo}
 * @date 2020/1/4 15:59
 */
@RestController
@RefreshScope
public class HelloController {

    @Value("${hello.msg}")
    private String msg;

    @GetMapping("/hello")
    public String hello(){
        return msg;
    }

    @GetMapping("/timeout/{time}")
    public String time(@PathVariable("time") int time){
        try {
            Thread.sleep(time*1000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return msg;
    }
}
